home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / shells / scsh-0.4 / scsh-0 / scsh-0.4.2 / env / basic-command.scm < prev    next >
Text File  |  1995-10-13  |  1KB  |  56 lines

  1. ; Copyright (c) 1993, 1994 Richard Kelsey and Jonathan Rees.  See file COPYING.
  2.  
  3.  
  4. ; run
  5.  
  6. (define-command-syntax 'run "<exp>" "evaluate an expression" '(expression))
  7.  
  8. (define (run exp)
  9.   (evaluate-and-select exp (environment-for-commands)))
  10.  
  11. ; exit
  12.  
  13. (define-command-syntax 'exit "[<status>]" "leave Scheme" '(&opt expression))
  14.  
  15. (define (exit . exp-option)
  16.   (let ((status (if (null? exp-option)
  17.                     0
  18.                     (evaluate (car exp-option) (environment-for-commands)))))
  19.     (exit-command-processor (lambda () status))))
  20.  
  21. ; go
  22.  
  23. (define-command-syntax 'go "<exp>" "leave Scheme via tail recursion"
  24.   '(expression))
  25.  
  26. (define (go exp)
  27.   (let ((env (environment-for-commands)))
  28.     (exit-command-processor (lambda () (evaluate exp env)))))
  29.  
  30. ; load
  31.  
  32. (define-command-syntax 'load "<filename> ..."
  33.   "load Scheme source file(s)"
  34.   '(&rest filename))
  35.  
  36. (define (load . filenames)
  37.   (let ((env (environment-for-commands)))
  38.     ;; (with-interaction-environment env
  39.       ;; (lambda ()
  40.     (noting-undefined-variables env
  41.       (lambda ()
  42.         (for-each (lambda (filename)
  43.             (load-into filename env))
  44.               filenames)))));; ))
  45.  
  46. ; help
  47.  
  48. (define ? help)
  49.  
  50. (define-command-syntax 'help
  51.   "[<command-name>]"
  52.   "list all commands, or give help on a specific command"
  53.   '(&opt name))
  54.  
  55. (define-command-syntax '? "[<command-name>]" "same as ,help" '(&opt name))
  56.